package com.cssy.xxkj.logic.dao.impl;

import com.cssy.xxkj.logic.dao.LogicProductionGetItemDAO;
import com.cssy.xxkj.logic.entity.LogicProductionGetItemDO;
import com.plat.helper.SearchConditions;

import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

/**
 * 数据访问对象实现类
 * @since 2014-10-09
 */
public class LogicProductionGetItemDAOImpl extends SqlMapClientDaoSupport implements LogicProductionGetItemDAO {

    /**
     * 插入数据
     * @param logicProductionGetItemDO
     * @return 插入数据的主键
     */
    public String insertLogicProductionGetItemDO(LogicProductionGetItemDO logicProductionGetItemDO) throws DataAccessException {
        Object id = getSqlMapClientTemplate().insert("LogicProductionGetItem.insert", logicProductionGetItemDO);
        return (String) id;
    }

    /**
     * 统计记录数
     * @param logicProductionGetItemDO
     * @return 查出的记录数
     */
    public Integer countLogicProductionGetItemDOByExample(LogicProductionGetItemDO logicProductionGetItemDO) throws DataAccessException {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicProductionGetItem.countByDOExample", logicProductionGetItemDO);
        return count;
    }

    /**
     * 更新记录
     * @param logicProductionGetItemDO
     * @return 受影响的行数
     */
    public Integer updateLogicProductionGetItemDO(LogicProductionGetItemDO logicProductionGetItemDO) throws DataAccessException {
        int result = getSqlMapClientTemplate().update("LogicProductionGetItem.update", logicProductionGetItemDO);
        return result;
    }

    /**
     * 获取对象列表
     * @param logicProductionGetItemDO
     * @return 对象列表
     */
    @SuppressWarnings("unchecked")
    public List<LogicProductionGetItemDO> findListByExample(LogicProductionGetItemDO logicProductionGetItemDO) throws DataAccessException {
        List<LogicProductionGetItemDO> list = getSqlMapClientTemplate().queryForList("LogicProductionGetItem.findListByDO", logicProductionGetItemDO);
        return list;
    }

    /**
     * 根据主键获取logicProductionGetItemDO
     * @param id
     * @return logicProductionGetItemDO
     */
    public LogicProductionGetItemDO findLogicProductionGetItemDOByPrimaryKey(String id) throws DataAccessException {
        LogicProductionGetItemDO logicProductionGetItemDO = (LogicProductionGetItemDO) getSqlMapClientTemplate().queryForObject("LogicProductionGetItem.findByPrimaryKey", id);
        return logicProductionGetItemDO;
    }

    /**
     * 删除记录
     * @param id
     * @return 受影响的行数
     */
    public Integer deleteLogicProductionGetItemDOByPrimaryKey(String id) throws DataAccessException {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicProductionGetItem.deleteByPrimaryKey", id);
        return rows;
    }

	@Override
	public List<LogicProductionGetItemDO> find(SearchConditions scs)
			throws DataAccessException {
		List<LogicProductionGetItemDO> list = getSqlMapClientTemplate().queryForList("LogicProductionGetItem_ex.find", scs);
        return list;
	}

	@Override
	public Integer count(SearchConditions scs) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicProductionGetItem_ex.count", scs);
        return count;
	}

	@Override
	public Integer deleteBizRemoved(String id) throws DataAccessException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Integer deleteProById(String id) throws DataAccessException {
		Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicProductionGetItem_ex.deleteProById", id);
        return rows;
	}

}